-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: add driver for ST VL6180X ranging and ambient light sensor #10462
Conversation
3c39e85
to
c40d0a0
Compare
I have the hardware for testing this PR, I'll do a code review this week. |
@aabadie Thanks 😄 |
drivers/include/vl6180x.h
Outdated
} vl6180x_error_t; | ||
|
||
/** | ||
* @brief Aanalogue gain of ALS measurements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: Analogue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
drivers/include/vl6180x.h
Outdated
*/ | ||
typedef enum { | ||
VL6180X_ALS_GAIN_20 = 0, /**< 20 x gain */ | ||
VL6180X_ALS_GAIN_100, /**< 10 x gain */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be 10 not 100 then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, of course 🕶️
tests/driver_vl6180x/main.c
Outdated
uint16_t als; | ||
uint16_t lux; | ||
|
||
#if MODULE_VL6180X_BASIC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be #ifdef
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why, the semantic is the same? By definition, an undefined macro can be tested for a zero. That is #if !
is exactly the same as #ifndef
and #if !defined()
.
drivers/vl6180x/vl6180.c
Outdated
return (status & VL6180X_RNG_ERR_CODE) ? VL6180X_ERROR_RNG : VL6180X_OK; | ||
} | ||
|
||
#if !MODULE_VL6180X_BASIC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be #ifndef
c40d0a0
to
0bf827a
Compare
@gschorcht Could you please rebase this PR ? |
I'm on vacation until August 27th. Is it ok to rebase it afterwards? |
No problem ! Enjoy your vacations ! |
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
GitHub status checks took too long to complete, so bors is giving up. You can adjust bors configuration to have it wait longer if you like. |
bors retry |
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
bors retry |
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
bors cancel |
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
@gschorcht Maybe a rebase can convince bors to pick this up? |
bors merge |
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
bors merge |
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
This needs a rebase for bors to accept it. |
7e89610
to
0bee1dd
Compare
bors merge |
Build succeeded: |
Thanks 😄 |
Contribution description
This PR adds a driver for the ST VL6180X ranging and ambient light sensor. The driver can be used in two variants which differ in functionality and size:
Both driver variants provide
In addition to these basic functionalities, the standard driver
vl6180x
provides interrupt handling, single shot measurements, a number of
configuration functions and power down / power up functionality.
Features of the driver variants are summarized in the following comparison
sheet.
Testing procedure
Using the make command
the standard driver variant
vl6180x
is used with the following defaultconfiguration parameters:
To use the basic driver variant, the
vl6180x_basic
module hasto be specified at make command line
The default configuration parameters used for the test application with the
basic driver variant are the same as for the standard driver variant.
To use interrupts to fetch new data instead of polling for new data
periodically, the standard driver variant
vl6180x
has to be used and thepin connected with the interrupt signal GPIO1 of the sensor has to be
defined by configuration paramater
VL6180X_PARAM_PIN_INT
, e.g.,To test the power down and power up functionality, the pin connected with
the signal GPIO0/CE of the sensor has to be defined by configuration
paramater
VL6180X_PARAM_PIN_SHUTDOWN
, e.g.,